package com.spider.business.service;

import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

import com.spider.business.dao.BasePaperMapper;
import com.spider.business.model.BasePaper;

public class BasePaperService {
	public void insertBean(BasePaper bp){
		try {
			String resource = "conf.xml";
			SqlSessionFactory ssf = new SqlSessionFactoryBuilder()
					.build(Resources.getResourceAsReader(resource));
			SqlSession session=ssf.openSession();
			BasePaperMapper bpm=session.getMapper(BasePaperMapper.class);
			bpm.insert(bp);
			session.commit();
			session.close();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
